package li.buda.utils.flex.validator.runner.simple {
import flash.events.EventDispatcher;

import li.buda.utils.flex.validator.ValidatorUtils;

import mx.events.ValidationResultEvent;
import mx.validators.ValidationResult;
import mx.validators.Validator;

public class SimpleExampleModel extends EventDispatcher {
    public function SimpleExampleModel() {
        super();
    }

    private var _login:String;

    public function setLogin(value:String):void {
        _login = value;
        validateLogin();
    }

    protected function validateLogin():void {
        if (_login.length < 3) {
            var e:ValidationResultEvent = ValidatorUtils.createInvalid();
            e.field = "login";
            var result : ValidationResult = new ValidationResult(true,"","","Login is to short");
            e.results = [result];
            dispatchEvent(e);
        }
    }


}
}